import { Models } from "../../common/typings/model";
import KoaRouter from 'koa-router'
import httpErrors from '../../core/HttpException'
import fs from 'fs'
import config from '../../config/config'
import bcrypt from "bcryptjs"
const router = new KoaRouter({
    prefix:'/api/v1/classic'
})
console.log('test')
router.get('/id',async (ctx: Models.Ctx,next:Function)=> {
    
    var salt = bcrypt.genSaltSync(10)
    var hash = bcrypt.hashSync("J.haha512", salt);
    console.log(hash)
    ctx.body = hash
    return
    const {
        id
    } = ctx.query
    // ctx.body = {
    //     id: id
    // }
    interface ZNode {
        id: number | string
        label: string
        point: number[]
        children?: ZNode []
    }
    let nodes: ZNode[] = [
        {
            id: 1,
            label: '大门',
            point: [125.34421153983293,43.90490841012243]
        },
        {
            id: 2,
            label: '路口1',
            point: [125.34436509781345,43.90437520567083],
            children: [
                {
                    id: '2-1',
                    label: '办公楼',
                    point: [125.34468294801172,43.90440983165086],
                },
            ]
        },
        {
            id: 3,
            label: '路口2',
            point: [125.34388516510515,43.90429575591968],
            children: [
                // 路口2到嘉乐殿
                {
                    id: '3-1',
                    label: '信息楼南门',
                    point: [125.34350184006084,43.904374373192454],
                    children: [
                        {
                            id: '3-1-1',
                            label: '嘉乐殿院门',
                            point: [125.34297686542295,43.90432750992695]
                        },
                    ]
                },
                {
                    id: '3-3',
                    label: '书画楼东南角',
                    point: [125.3438263951939,43.90443372549653],
                    children: [
                        {
                            id: '3-3-1',
                            label: '信息楼南门',
                            point: [125.3433878391547,43.90437448699589],
                        },
                        {
                            id: '3-3-2',
                            label: '书画楼最北面',
                            point: [125.34375317623265,43.90467948354242],
                            children: [
                                {
                                    id: '3-3-2-1',
                                    label: '书画楼最北面,里侧',
                                    point: [125.34321342009669,43.90460922606882],
                                }
                            ]
                        },
                        
                    ]
                }
                
            ]
        },
        {
            id: 4,
            label: '防空洞北',
            point: [125.3439424564408,43.904053235247865],
        },
        {
            id: 4,
            label: '防空洞北',
            point: [125.3439424564408,43.904053235247865],
        },
        {
            id: '4.5',
            label: '同德殿东南门口不远',
            point: [125.34345283238042,43.903831179569494],
            children: [
                {
                    id: '4.5-1',
                    label: '防空洞西南侧',
                    point: [125.34363471931944,43.90363845269245],
                }
            ]
            
        },
        {
            id: '5',
            label: '同德殿南',
            point: [125.3431127537918,43.903744924166276],
            children: [
                {
                    id: '5-1',
                    label: '同德殿南门东出口',
                    point: [125.34303964473428,43.90383719958057],
                }
            ]
        },
        {
            id: 6,
            label: '东厢房',
            point: [125.3429705833849,43.903710874703016],
            children: [
                // {
                //     id: '6-1-1',
                //     label: '厢房院门',
                //     point: [125.34268300341985,43.90377933867499],
                // },
                {
                    id: '6-1-1',
                    label: '厢房院门',
                    point: [125.34268300341985,43.90377933867499],
                    children: [
                        {
                            id: '6-1-1-1',
                            label: '东厢房北路口',
                            point: [125.34254955529784,43.90375098794463],
                            children: [
                                {
                                    id: '6-1-1-1-1',
                                    label: '缉熙楼北门',
                                    point: [125.34236002749712,43.90373011730389],
                                    children: [
                                        {
                                            id: '6-1-1-1-1-1',
                                            label: '勤民楼南门',
                                            point: [125.34229907165555, 43.903968799417406]
                                        },
                                        {
                                            id: '6-1-1-1-1-2',
                                            label: '西厢房北路口',
                                            point: [125.34218326518993,43.903703025139876],
                                            children: [
                                                {
                                                    id: '6-1-1-1-1-2-1',
                                                    label: '西厢房东门1',
                                                    point: [125.34220026182915,43.903583907146604],
                                                    children: [
                                                        {
                                                            id: '6-1-1-1-1-2-1-1',
                                                            label: '西厢房东门2',
                                                            point: [125.34226294435709,43.90339662835229]
                                                        }
                                                    ]
                                                },
                                                
                                            ]
                                        },
                                        {
                                            id: '6-1-1-1-1-3',
                                            label: '西厢房北侧',
                                            point: [125.34207373394291,43.90368595927107],
                                            children: [
                                                {
                                                    id: '6-1-1-1-1-3-1',
                                                    label: '植秀轩南侧花坛中心路口',
                                                    point: [125.34187477537195,43.9036535363658],
                                                    children: [
                                                        {
                                                            id: '6-1-1-1-1-3-1-1',
                                                            label: '植秀轩南门',
                                                            point: [125.3418575288774,43.903728027680415],
                                                            
                                                        }
                                                    ]
                                                },
                                                
                                            ]
                                        },
                                        
                                        
                                    ]
                                },
                                {
                                    id: '6-1-1-1-2',
                                    label: '东厢房西门1',
                                    point: [125.34260225650823,43.90364795069292],
                                    children: [
                                        {
                                            id: '6-1-1-1-2-1',
                                            label: '缉熙楼东南角',
                                            point: [125.34259406836314,43.90351883132925],
                                            children: [
                                                {
                                                    id: '6-1-1-1-2-1-1',
                                                    label: '缉熙楼南门',
                                                    point: [125.34243031687016,43.90350026523481]
                                                },
                                                {
                                                    id: '6-1-1-1-2-1-2',
                                                    label: '东厢房西门2',
                                                    point: [125.34263572500052,43.903455502217604],
                                                    children: [
                                                        {
                                                            id: '6-1-1-1-2-1-2-1',
                                                            label: '南厢房北门',
                                                            point: [125.3424795715154,43.9033383791149],
                                                            children: [
                                                                {
                                                                    id: '6-2-1-1-1-1-2-1-1',
                                                                    label: '缉熙楼南门',
                                                                    point: [125.34242575661766,43.90349551768061],
                                                                },
                                                            ]
                                                        },
                                                    ]
                                                },
                                                
                                            ]
                                        },
                                        
                                    ]
                                },
                                
                                
                                
                            ]
                            
                            
                        },
                        {
                            id: '6-1-1-2',
                            label: '厢房院门里侧，往北拐',
                            point: [125.34264872522273,43.903772499587255],
                            children: [
                                {
                                    id: '6-1-1-2-1',
                                    label: '勤民楼大院东南角内侧',
                                    point: [125.3426094405469,43.90386815163498],
                                    children: [
                                        {
                                            id: '6-1-1-2-1-x-1',
                                            label: '勤民楼大院,偏东南',
                                            point: [125.34251749720298,43.903897331811784],
                                            children: [
                                                {
                                                    id: '6-1-1-2-1-1',
                                                    label: '勤民楼南门',
                                                    point: [125.34231214882756,43.90396650245275],
                                                    children: [
                                                        {
                                                            id: '6-1-1-2-1-1-1',
                                                            label: '勤民楼西南角',
                                                            point: [125.34209548126199,43.903923679857996],
                                                            children: [
                                                                {
                                                                    id: '6-1-1-2-1-1-1-1',
                                                                    label: '勤民楼西侧，将左拐',
                                                                    point: [125.34204622152626,43.904106651614384],
                                                                    children: [
                                                                        {
                                                                            id: '6-1-1-2-1-1-1-1-1',
                                                                            label: '畅春轩东北角路口',
                                                                            point: [125.34193577957795,43.904069725776786],
                                                                            children: [
                                                                                {
                                                                                    id: '6-1-1-2-1-1-1-1-1',
                                                                                    label: '畅春轩北侧路口',
                                                                                    point: [125.34177162955586,43.90404621709502],
                                                                                    children: [
                                                                                        {
                                                                                            id: '6-1-1-2-1-1-1-1-1-1',
                                                                                            label: '畅春轩西北侧出口',
                                                                                            point: [125.34148771835257,43.90400774490539],
                                                                                            children: [
                                                                                                {
                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1',
                                                                                                    label: '宫内府，跑马场东北角',
                                                                                                    point: [125.34118353261918,43.90413211754738],
                                                                                                    children: [
                                                                                                        {
                                                                                                            id: '6-1-1-2-1-1-1-1-1-1-1-1',
                                                                                                            label: '跑马场东北角,路口',
                                                                                                            point: [125.34083709757603,43.904147991564194],
                                                                                                            children: [
                                                                                                                {
                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1',
                                                                                                                    label: '跑马场西北角，弧线起点',
                                                                                                                    point: [125.33903469812682,43.903875153678506],
                                                                                                                    children: [
                                                                                                                        {
                                                                                                                            id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1',
                                                                                                                            label: '跑马场西北角，弧线终点',
                                                                                                                            point: [125.33899629305459,43.903839025395136],
                                                                                                                            children: [
                                                                                                                                {
                                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                    label: '跑马场西南角，弧线起点',
                                                                                                                                    point: [125.33933940968221,43.90270571030736],
                                                                                                                                    children: [
                                                                                                                                        {
                                                                                                                                            id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                            label: '跑马场西南角，弧线终点',
                                                                                                                                            point: [125.33939147579541,43.90267034005431],
                                                                                                                                            children: [
                                                                                                                                                {
                                                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                    label: '跑马场西线，弯道1',
                                                                                                                                                    point: [125.3396203517489,43.90267974475236],
                                                                                                                                                    children: [
                                                                                                                                                        {
                                                                                                                                                            id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                            label: '跑马场西线，弯道2',
                                                                                                                                                            point: [125.3399029977062,43.90273240552752],
                                                                                                                                                            children: [
                                                                                                                                                                {
                                                                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                                    label: '跑马场西线，弯道3',
                                                                                                                                                                    point: [125.34012389646452,43.90277669770838],
                                                                                                                                                                    children: [
                                                                                                                                                                        {
                                                                                                                                                                            id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                                            label: '跑马场西线，弯道4',
                                                                                                                                                                            point: [125.34047708626612,43.90280566053431],
                                                                                                                                                                            children: [
                                                                                                                                                                                {
                                                                                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                                                    label: '跑马场西线，弯道5',
                                                                                                                                                                                    point: [125.34059956127207,43.9027947088239],
                                                                                                                                                                                    children: [
                                                                                                                                                                                        {
                                                                                                                                                                                            id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                                                            label: '跑马场西线，弯道6',
                                                                                                                                                                                            point: [125.34090223208868,43.90271328081858],
                                                                                                                                                                                            children: [
                                                                                                                                                                                                {
                                                                                                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                                                                    label: '跑马场西线，弯道7',
                                                                                                                                                                                                    point: [125.34110726736768,43.902690803448756],
                                                                                                                                                                                                    children: [
                                                                                                                                                                                                        {
                                                                                                                                                                                                            id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                                                                            label: '跑马场西线，弯道8',
                                                                                                                                                                                                            point: [125.34143284049537,43.90275538793061],
                                                                                                                                                                                                            children: [
                                                                                                                                                                                                                {
                                                                                                                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                                                                                    label: '跑马场西线，弯道9，到达御用厨房西南方出口',
                                                                                                                                                                                                                    point: [125.3415838154087,43.90285569732368],
                                                                                                                                                                                                                    children: [
                                                                                                                                                                                                                        {
                                                                                                                                                                                                                            id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                                                                                            label: '御用厨房西南方出口,可往北拐',
                                                                                                                                                                                                                            point: [125.34165379548702,43.90286460561901],
                                                                                                                                                                                                                            children: [
                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                                                                                                    label: '御用厨房南侧',
                                                                                                                                                                                                                                    point: [125.342037710899,43.90291462957015],
                                                                                                                                                                                                                                    children: [
                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                            id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                                                                                                            label: '御用厨房南侧出口',
                                                                                                                                                                                                                                            point: [125.34209992271407,43.902648813644994],
                                                                                                                                                                                                                                            children: [
                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                                                                                                                    label: '西南方向大道',
                                                                                                                                                                                                                                                    point: [125.34198063803251,43.9025202055125],
                                                                                                                                                                                                                                                    children: [
                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                            id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                                                                                                                            label: '西南方向大道路口',
                                                                                                                                                                                                                                                            point: [125.34186906804364,43.902398376423946],
                                                                                                                                                                                                                                                            children: [
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1',
                                                                                                                                                                                                                                                                    label: '西南方向大道终点',
                                                                                                                                                                                                                                                                    point: [125.34122263368887,43.9016721385548]
                                                                                                                                                                                                                                                                },
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-2',
                                                                                                                                                                                                                                                                    label: '西南方向大道路口往东',
                                                                                                                                                                                                                                                                    point: [125.34232497980764,43.902257470698366]
                                                                                                                                                                                                                                                                },
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-3',
                                                                                                                                                                                                                                                                    label: '西南方向大道路口往西',
                                                                                                                                                                                                                                                                    point: [125.34104423823833,43.902424051644644]
                                                                                                                                                                                                                                                                },
                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                            ]
                                                                                                                                                                                                                                                        },
                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                            id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-2',
                                                                                                                                                                                                                                                            label: '御用厨房南侧出口往东',
                                                                                                                                                                                                                                                            point: [125.34230239890556,43.90235526850488]
                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                        
                                                                                                                                                                                                                                                    ]
                                                                                                                                                                                                                                                    // 
                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                            ]
                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                    ]
                                                                                                                                                                                                                                },
                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-2',
                                                                                                                                                                                                                                    label: '跑马场东侧跑道',
                                                                                                                                                                                                                                    point: [125.34160733486895,43.902919007337005],
                                                                                                                                                                                                                                    children: [
                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                            id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-2-1',
                                                                                                                                                                                                                                            label: '跑马场东侧跑道,往北，弧线1',
                                                                                                                                                                                                                                            point: [125.34161402480602,43.90302798279773],
                                                                                                                                                                                                                                            children: [
                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-2-1-1',
                                                                                                                                                                                                                                                    label: '跑马场东侧跑道,往北，弧线2',
                                                                                                                                                                                                                                                    point: [125.3415475761427,43.90317217983519],
                                                                                                                                                                                                                                                    children: [
                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                            id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-2-1-1-1',
                                                                                                                                                                                                                                                            label: '跑马场东侧跑道,往北，弧线3',
                                                                                                                                                                                                                                                            point: [125.3415304837277,43.90338196884133],
                                                                                                                                                                                                                                                            children: [
                                                                                                                                                                                                                                                                {
                                                                                                                                                                                                                                                                    id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-2-1-1-1-1',
                                                                                                                                                                                                                                                                    label: '跑马场东侧跑道,往北，弧线4',
                                                                                                                                                                                                                                                                    point: [125.34157132029301,43.903550998853085],
                                                                                                                                                                                                                                                                    children: [
                                                                                                                                                                                                                                                                        {
                                                                                                                                                                                                                                                                            id: '6-1-1-2-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-1-2-1-1-1-1-1',
                                                                                                                                                                                                                                                                            label: '畅春轩与宫内府西侧出口',
                                                                                                                                                                                                                                                                            point: [125.34148361834322,43.90402021888328]
                                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                                    ]
                                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                                            ]
                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                    ]
                                                                                                                                                                                                                                                }
                                                                                                                                                                                                                                            ]
                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                    ]
                                                                                                                                                                                                                                }
                                                                                                                                                                                                                            ]
                                                                                                                                                                                                                        }
                                                                                                                                                                                                                        
                                                                                                                                                                                                                    ]
                                                                                                                                                                                                                }
                                                                                                                                                                                                            ]
                                                                                                                                                                                                        }
                                                                                                                                                                                                    ]
                                                                                                                                                                                                }
                                                                                                                                                                                            ]
                                                                                                                                                                                        }
                                                                                                                                                                                    ]
                                                                                                                                                                                }
                                                                                                                                                                            ]
                                                                                                                                                                        }
                                                                                                                                                                    ]
                                                                                                                                                                }
                                                                                                                                                            ]
                                                                                                                                                        }
                                                                                                                                                    ]
                                                                                                                                                }
                                                                                                                                            ]
                                                                                                                                        },
                                                                                                                                        {
                                                                                                                                            id: 'eqwqewq311321',
                                                                                                                                            label: '跑马场西南角，继续往西',
                                                                                                                                            point: [125.33927401710748,43.9026721863446],
                                                                                                                                            children: [
                                                                                                                                                {
                                                                                                                                                    id: 'eqwqewq311321',
                                                                                                                                                    label: '跑马场西南角，继续往西',
                                                                                                                                                    point: [125.33927401710748,43.9026721863446],
                                                                                                                                                    children: [
                                                                                                                                                        {
                                                                                                                                                            id: 'eqwqewq31132wqw1',
                                                                                                                                                            label: '往西',
                                                                                                                                                            point: [125.33916116043831,43.90265734365883],
                                                                                                                                                            children: [
                                                                                                                                                                {
                                                                                                                                                                    id: 'eqwqewq31132wwwqwqwqw1',
                                                                                                                                                                    label: '西南角大厅',
                                                                                                                                                                    point: [125.33908962280556,43.902716068545544]
                                                                                                                                                                }
                                                                                                                                                            ]
                                                                                                                                                        }
                                                                                                                                                    ]
                                                                                                                                                }
                                                                                                                                            ]
                                                                                                                                        }
                                                                                                                                    ]
                                                                                                                                }
                                                                                                                                
                                                                                                                                
                                                                                                                            ]
                                                                                                                        },
                                                                                                                    ]
                                                                                                                },
                                                                                                            ]
                                                                                                        },
                                                                                                        {
                                                                                                            id: 'w232',
                                                                                                            label: '',
                                                                                                            point: [125.34111067663703,43.90426732315374]
                                                                                                        }
                                                                                                    ]
                                                                                                    
                                                                                                },
                                                                                            ]
                                                                                        },
                                                                                        {
                                                                                            id: '6-1-1-2-1-1-1-1-1-2',
                                                                                            label: '畅春轩北门',
                                                                                            point: [125.3417753220273,43.90402982443469],
                                                                                        },
                                                                                        {
                                                                                            id: '6-1-1-2-1-1-1-1-1-3',
                                                                                            label: '宫内府南门',
                                                                                            point: [125.34172481172115,43.90408935406964],
                                                                                            
                                                                                        }
                                                                                    ]
                                                                                },
                                                                                {
                                                                                    id: '6-1-1-2-1-1-1-1-2',
                                                                                    label: '畅春轩东南角',
                                                                                    point: [125.3419898354746,43.90388235091097],
                                                                                    children: [
                                                                                        {
                                                                                            id: '6-1-1-2-1-1-1-1-2-1-1',
                                                                                            label: '畅春轩南侧路口',
                                                                                            point: [125.34181724785337,43.903870392694046],
                                                                                            children: [
                                                                                                {
                                                                                                    id: '6-1-1-2-1-1-1-1-2-1-1-1',
                                                                                                    label: '畅春轩南门',
                                                                                                    point: [125.3418094751313,43.90390144783564],
                                                                                                }
                                                                                            ]
                                                                                        },
                                                                                        {
                                                                                            id: '6-1-1-2-1-1-1-1-2-1',
                                                                                            label: '植秀轩东南角',
                                                                                            point: [125.3420215294409,43.903671089875616],
                                                                                            children: [
                                                                                                {
                                                                                                    id: '6-1-1-2-1-1-1-1-2-1-1',
                                                                                                    label: '植秀轩南侧路口',
                                                                                                    point: [125.34188091015741,43.903650977079906],
                                                                                                    children: [
                                                                                                        {
                                                                                                            id: '6-1-1-2-1-1-1-1-2-1-1-1',
                                                                                                            label: '植秀轩南门',
                                                                                                            point: [125.34186343942282,43.903727271839074]
                                                                                                        }
                                                                                                    ]
                                                                                                }
                                                                                            ]
                                                                                        }
                                                                                    ]
                                                                                }
                                                                            ]
                                                                        }
                                                                    ]
                                                                }
                                                            ]
                                                        },
                                                        {
                                                            id: '6-1-1-2-1-1-2',
                                                            label: '勤民楼大院西南角',
                                                            point: [125.34204310870027,43.9038373050696],
                                                            children: [
                                                                {
                                                                    id: '6-1-1-2-1-1-2-1',
                                                                    label: '植秀轩东南角',
                                                                    point: [125.34206137371439,43.903700067995224]
                                                                }
                                                            ]
                                                        }
                                                        
                                                    ]
                                                    
                                                },
                                                {
                                                    id: '6-1-1-2-1-2',
                                                    label: '勤民楼东北角',
                                                    point: [125.3424905319419,43.903991146304406],
                                                    children: [
                                                        {
                                                            id: '6-1-1-2-1-2-1',
                                                            label: '勤民楼东侧，偏南',
                                                            point: [125.34245897695591,43.904119266378785],
                                                            children: [
                                                                {
                                                                    id: '6-1-1-2-1-2-1-1',
                                                                    label: '勤民楼东侧路口',
                                                                    point: [125.34249817690745,43.90416216886608],
                                                                    children: [
                                                                        {
                                                                            id: '6-1-1-2-1-2-1-1-1',
                                                                            label: '勤民楼东侧，偏北',
                                                                            point: [125.34244237969996,43.90419724746378],
                                                                            children: [
                                                                                {
                                                                                    id: '6-1-1-2-1-2-1-1-1-1',
                                                                                    label: '勤民楼东北角',
                                                                                    point: [125.34240100305414,43.90433107266588],
                                                                                    children: [
                                                                                        {
                                                                                            id: '6-1-1-2-1-2-1-1-1-1-1',
                                                                                            label: '怀远楼院内',
                                                                                            point: [125.34223497542062,43.904356781937686],
                                                                                        }
                                                                                    ]
                                                                                }
                                                                            ]
                                                                        },
                                                                        {
                                                                            id: '6-1-1-2-1-2-1-1-2',
                                                                            label: '嘉乐殿西南角',
                                                                            point: [125.3424340902746,43.90437743915265]
                                                                        }
                                                                    ]
                                                                }
                                                            ]
                                                        }
                                                    ]
                                                }
                                            ]
                                        },
                                        
                                    ]
                                }
                            ]
                            
                        }
                    ]
                },
                {
                    
                    id:'6-2',
                    label: '同德殿南门',
                    point: [125.34294295600522,43.903760415971085],
                    // children: [
                       
                    // ]
                    
                },
                
            ]
        },
        {
            id: 13,
            label: '检票厅',
            point: [125.34308160194433,43.90316476957848],
        },
        {
            id: 14,
            label: '检票大门外',
            point: [125.34260404622512,43.90305419243069],
            children: [
                {
                    id: '14-1',
                    label: '南厢房南门',
                    point: [125.34252005634346,43.90317891934402]
                }
            ]
        },
        {
            id: 15,
            label: '南厢房南侧',
            point: [125.34242632758344,43.90301417462768],
            children: [
                {
                    id: '15-1',
                    label: '御用厨房',
                    point: [125.34200609597109,43.90305524903998],
                }
            ]
        },
        {
            id: 16,
            label: '南门内',
            point: [125.34235044824084,43.902919271368795],
            
        },
        {
            id: 17,
            label: '南门',
            point: [125.34211321844273,43.902626599190405],
        },
        {
            id: 18,
            label: '南门外路口',
            point: [125.34201637141089,43.902514843618526],
            children: [
                {
                    id: '18-1',
                    label: '南门外路口东侧',
                    point: [125.34231380192941,43.90236306634178],
                }
            ]
            
        },
        {
            id: 19,
            label: '南门外西南方向大道路口中心',
            point: [125.34186558229716,43.90236251278417],
            children: [
                {
                    id: '19-1',
                    label: '路口向右',
                    point: [125.34234442526208,43.90226646128213],
                }
            ]
        },
        {
            id: 20,
            label: '南门外西南方向大道终点',
            point: [125.34124883013702,43.90166636926679],
        },
        
        
        
    ]
    setNodeId(nodes)
    console.log(nodes)
    const res = await fs.writeFileSync(`${process.cwd()}/${config.base}/public/json/test/nodes.json`, JSON.stringify(nodes))
    function setNodeId(nodes: ZNode[]) {
        nodes.forEach((node: ZNode) => {
            let id = getRandom(12)
            node.id = id
            if(node.children){
                setNodeId(node.children!)
            }
        })
    }
    function getRandom(num: number){
        return Math.floor((Math.random()+Math.floor(Math.random()*9+1))*Math.pow(10,num-1));
    }
    throw new httpErrors.Success(res)
})

export default router